<template>
	<view class="p-b-10">
		<common-list @load="downList" :list="list" :status="status">
			<template #list>
				<view class="p-t-34 p-r-30 p-b-34 p-l-30 back-color-c m-t-20" v-for="(item, i) in list" :key="i" @click="jump(`/pages/webview/pdf?src=${encodeURI(item.pdf_url)}`)">
					<view class="font-32 color-d line-1">{{item.name}}</view>
					<view class="font-28 color-a m-t-8 line-1">{{item.create_time | date('yyyy-mm-dd hh:MM:ss')}}</view>
				</view>
			</template>
			<template #empty>
				<empty text="列表空空如也～"></empty>
			</template>
		</common-list>
	</view>
</template>

<script>
	export default {
		name: "download",
		data() {
			return {
				page: 1,
				status: 'loading',
				list: []
			}
		},
		onLoad() {
			this.downList()
		},
		methods: {
			async downList() {
				let params = {
					page: this.page
				}
				const res = await this.$api.common.landlord('downList', params)
				if (res.code === 200) {
					const {
						count,
						list
					} = res.data
					this.list = [...this.list, ...list]
					if (this.list.length >= count) {
						// 所有数据加载完毕
						this.status = 'nomore'
						return
					}
					// 单次请求数据完毕
					this.status = 'loadmore'
					this.page = this.page + 1
				}
			}
		}
	}
</script>

<style>
</style>
